package demo.proxy.dyn.jdk;

import demo.proxy.sta.RegisterService;
import demo.proxy.sta.RegisterServiceImpl;
import entity.Student;

/**
 *JDK实现动态代理测试
 *
 * @author dingwen
 * 2021.05.25 13:41
 */
public class TestJdkDynamic {
    public static void main(String[] args) {
        MyInvocationHandler myInvocationHandler = new MyInvocationHandler();
        RegisterService registerService = new RegisterServiceImpl();
        Student student = new Student();
        student.setId("2");
        student.setGender("nan");
        student.setName("lucy");
        RegisterService proxy = (RegisterService)myInvocationHandler.getProxy(registerService);
        proxy.register(student);
    }
}
